var elementCode="";//全局变量，用于查询详细元素的报警信息
//系统加完运行
$(function () {
    tick();
    setInterval("tick();", 1000);
    roadChart();
    visibilityChart();
    weatherChart();
    equipmentStatus();
    setInterval("roadChart();", 300000);
    setInterval("weatherChart();", 300000);
    setInterval("visibilityChart();", 300000);
    setInterval("equipmentStatus();", 300000);
    getRoleCoordinates();
});
var user={};
//系统时间
function tick() {
    var years,
        months,
        days,
        hours,
        minutes,
        seconds;
    var intYears,
        intMonths,
        intDays,
        intHours,
        intMinutes,
        intSeconds;
    var today;
    today = new Date(); //系统当前时间
    intYears = today.getFullYear(); //得到年份,getFullYear()比getYear()更普适
    intMonths = today.getMonth() + 1; //得到月份，要加1
    intDays = today.getDate(); //得到日期
    intHours = today.getHours(); //得到小时
    intMinutes = today.getMinutes(); //得到分钟
    intSeconds = today.getSeconds(); //得到秒钟
    years = intYears + "-";
    if (intMonths < 10) {
        months = "0" + intMonths + "-";
    } else {
        months = intMonths + "-";
    }
    if (intDays < 10) {
        days = "0" + intDays + " ";
    } else {
        days = intDays + " ";
    }
    if (intHours == 0) {
        hours = "00:";
    } else if (intHours < 10) {
        hours = "0" + intHours + ":";
    } else {
        hours = intHours + ":";
    }
    if (intMinutes < 10) {
        minutes = "0" + intMinutes + ":";
    } else {
        minutes = intMinutes + ":";
    }
    if (intSeconds < 10) {
        seconds = "0" + intSeconds + " ";
    } else {
        seconds = intSeconds + " ";
    }
    timeString = years + months + days + hours + minutes + seconds;
    $("#showTimeDiv").html(timeString);
}
//显示用户名
function getUser() {
    $.getJSON("sys/user/info?_"+$.now(), function(r){
        $("#loginName").html("用户名： " + r.user.username);
        user=r.user;
        if(r.user.mapTheme!='' && r.user.mapTheme!= null){
            amap.setMapStyle('amap://styles/' + r.user.mapTheme);

            $("#" + r.user.mapTheme).addClass("xuanze");
            a = $(".xuanze p").eq(0).attr("value");
            $(".xuanze").css("background-image", "url(../statics/image/" + a + "1.png)");
            $(".xuanze p").eq(0).css("color", "#0ff");
        }
    });
}

//湿滑程度极值
function sendFriction(result) {
    if (result.minFriction.friction == null) {
        $("#shcdSpan").html("-");
    } else {
        var a = result.minFriction.friction;
        var b = "";
        if (a <= 0.30) {
            b = "极差";
            //$("#shcdSpan").css("color","red");
            //$("#shcdSpan1").css("color","red");
        } else if (a <= 0.40) {
            b = "很差";
            //$("#shcdSpan").css("color","#orange");
            //$("#shcdSpan1").css("color","#orange");
        } else if (a <= 0.50) {
            b = "较差";
            //$("#shcdSpan").css("color","#yellow");
            //$("#shcdSpan1").css("color","#yellow");
        } else if (a <= 0.55) {
            b = "稍差";
            //$("#shcdSpan").css("color","#00aeff");
            //$("#shcdSpan1").css("color","#00aeff");
        } else if (a <= 0.64) {
            b = "正常";
            //$("#shcdSpan").css("color","#19bb9a");
            //$("#shcdSpan1").css("color","#19bb9a");
        } else {
            b = "良好";
            //$("#shcdSpan").css("color","#19bb9a");
            //$("#shcdSpan1").css("color","#19bb9a");
        }
        $("#shcdSpan").html(a+"("+b+")");
        $("#xy2").val(result.minFriction.pointId);
    }
}
//路面温度极值
function sendRoadTemp(result) {
    if (result.minTemp.roadSurfaceTemp == null) {
        $("#lmwdSpan").html("-");
    } else {
        $("#lmwdSpan").html(result.minTemp.roadSurfaceTemp+"℃");
        var a = result.minTemp.roadSurfaceTemp;
        $("#xy1").val(result.minTemp.pointId);
    }
}
//相对湿度极值
function sendRelativeHumidity(result){
    if (result.maxRelativeHumidity.relativeHumidity == null) {
        $("#xdsdSpan").html("-");
    } else {
        $("#xdsdSpan").html(result.maxRelativeHumidity.relativeHumidity+"%");
        $("#xy6").val(result.maxRelativeHumidity.pointId);
    }
}
//空气温度极值
function sendWeatherTemp(result){
    if (result.minWeatherTemp.airTemp == null) {
        $("#kqwdSpan").html("-");
    } else {
        $("#kqwdSpan").html(result.minWeatherTemp.airTemp+"℃");
        $("#xy5").val(result.minWeatherTemp.pointId);
    }
}
//风速极值
function sendWendSpeed(result){
    if (result.maxWindSpeed.windSpeed == null) {
        $("#fsSpan").html("-");
    } else {
        $("#fsSpan").html(result.maxWindSpeed.windSpeed+"m/s");
        $("#xy7").val(result.maxWindSpeed.pointId);
    }
}
//降水量极值
function sendPrecipitation(result){
    if (result.maxPrecipitation.precipitation == null) {
        $("#jslSpan").html("-");
    } else {
        $("#jslSpan").html(result.maxPrecipitation.precipitation+"mm");
        $("#xy8").val(result.maxPrecipitation.pointId);
    }
}
//水膜高度
function sendWaterFilmHeight(result) {
    if (result.minWaterFilmHeight.waterFilmHeight == null) {
        $("#smhdSpan").html("-");
    } else {
        if(result.minWaterFilmHeight.waterFilmHeight<100){
            $("#smhdSpan").html(result.minWaterFilmHeight.waterFilmHeight+"μm");
        }else{
            $("#smhdSpan").html(Math.round(result.minWaterFilmHeight.waterFilmHeight)+"μm");
        }
        $("#xy4").val(result.minWaterFilmHeight.pointId);
    }
}
//能见度极值
function sendVisibility(result) {
    if (result.minVisi.visibility == null) {
        $("#njdSpan").html("-");
    } else {
        var a = result.minVisi.visibility;
        var b = "";
        if (a <= 50) {
            b = "大雾";
            //$("#njdSpan").css("color","red");
        } else if (a <= 200) {
            b = "浓雾";
            //$("#njdSpan").css("color","red");
        } else if (a <= 500) {
            b = "雾";
            //$("#njdSpan").css("color","orange");
        } else if (a <= 1000) {
            b = "中雾";
            //$("#njdSpan").css("color","yellow");
        } else if (a < 2000) {
            b = "轻雾";
            //$("#njdSpan").css("color","#00aeff");
        } else {
            b = "良好";
            //$("#njdSpan").css("color","#19bb9a");
        }
        $("#njdSpan").html(result.minVisi.visibility.split(".")[0]+"("+b+")");
        $("#xy3").val(result.minVisi.pointId);
    }

}
//路面数据统计
function roadChart(){
    $.getJSON("baseinfo/lhpdataroaddetector/roadChart?_"+$.now(), function(r){
        var data=r.data;
        sendFriction(data);
        sendRoadTemp(data);
        sendWaterFilmHeight(data);
        var pNameList = data.pNameList;
        var tempList = data.tempList;
        var fricationList = data.fricationList;
        var waterFilmHeightList = data.waterFilmHeightList;
        var myChart1 = echarts.init(document.getElementById('roadChart'));
        var colors = ['#5793f3', '#d14a61', '#675bba'];
        option1 = {
            color: colors,
            tooltip: {
                trigger: 'axis',
            },
            grid: {
                left:30,
                right:90,
                top:45,
                bottom:50
            },

            legend: {
                data:[{
                    name :'路面温度',
                    textStyle : {
                        color : "#ffffff"
                    }
                },
                    {
                        name :'湿滑程度',
                        textStyle : {
                            color : "#ffffff"
                        }
                    },
                    {
                        name :'水膜厚度',
                        textStyle : {
                            color : "#ffffff"
                        }
                    }
                ]
            },
            xAxis: [
                {
                    splitLine:{show: false},
                    splitArea : {show : false},
                    type: 'category',
                    axisLine:{
                        lineStyle:{
                            color:'white',
                            width:1
                        }
                    },
                    axisLabel: {
                        interval:0,
                        rotate:40
                    },
                    axisTick: {
                        alignWithLabel: true
                    },
                    data: pNameList
                }
            ],
            yAxis: [

                {	splitLine:{show: false},
                    splitArea : {show : false},
                    type: 'value',
                    name: '路面温度',
                    // min: 0,
                    //max: 60,
                    position: 'left',
                    axisLine: {
                        lineStyle: {
                            color: colors[0]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {splitLine:{show: false},
                    splitArea : {show : false},
                    type: 'value',
                    name: '湿滑程度',
                    min: 0,
                    max: 1,
                    position: 'right',
                    axisLine: {
                        lineStyle: {
                            color: colors[1]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {splitLine:{show: false},
                    splitArea : {show : false},
                    type: 'value',
                    name: '水膜厚度',
                    position: 'right',
                    offset: 50,
                    axisLine: {
                        lineStyle: {
                            color: colors[2]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                }
            ],
            series: [
                {
                    name:'路面温度',
                    type:'line',
                    yAxisIndex: 0,
                    data: tempList
                },
                {
                    name:'湿滑程度',
                    type:'line',
                    yAxisIndex: 1,
                    data: fricationList
                },
                {
                    name:'水膜厚度',
                    type:'line',
                    yAxisIndex: 2,
                    data: waterFilmHeightList
                }
            ]
        };
        myChart1.setOption(option1);

        $(window).on('resize',
            function() {
                myChart1.resize();
            });
    });
}

//气象数据统计
function weatherChart(){
    $.getJSON("baseinfo/lhpdataweatherstation/weatherChart?_"+$.now(), function(r){
        var data=r.data;
        sendWeatherTemp(data);
        sendRelativeHumidity(data);
        sendWendSpeed(data);
        sendPrecipitation(data);
        var pNameList = data.pNameList;
        var weatherTempList = data.weatherTempList;
        var windSpeedList = data.windSpeedList;
        var precipitationList = data.precipitationList;
        var myChart3 = echarts.init(document.getElementById('weatherChart'));
        var colors = ['#5793f3', '#d14a61', '#675bba'];
        option2 = {
            color: colors,
            tooltip: {
                trigger: 'axis',
            },
            grid: {
                left:30,
                right:90,
                top:45,
                bottom:50
            },

            legend: {
                data:[{
                    name :'空气温度',
                    textStyle : {
                        color : "#ffffff"
                    }
                },
                    {
                        name :'风速',
                        textStyle : {
                            color : "#ffffff"
                        }
                    },
                    {
                        name :'降水量',
                        textStyle : {
                            color : "#ffffff"
                        }
                    }
                ]
            },
            xAxis: [
                {
                    splitLine:{show: false},
                    splitArea : {show : false},
                    type: 'category',
                    axisLine:{
                        lineStyle:{
                            color:'white',
                            width:1
                        }
                    },
                    axisLabel: {
                        interval:0,
                        rotate:40
                    },
                    axisTick: {
                        alignWithLabel: true
                    },
                    data: pNameList
                }
            ],
            yAxis: [

                {	splitLine:{show: false},
                    splitArea : {show : false},
                    type: 'value',
                    name: '空气温度',
                    // min: 0,
                    //max: 60,
                    position: 'left',
                    axisLine: {
                        lineStyle: {
                            color: colors[0]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {splitLine:{show: false},
                    splitArea : {show : false},
                    type: 'value',
                    name: '风速',
                    min: 0,
                    max: 1,
                    position: 'right',
                    axisLine: {
                        lineStyle: {
                            color: colors[1]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {splitLine:{show: false},
                    splitArea : {show : false},
                    type: 'value',
                    name: '降水量',
                    position: 'right',
                    offset: 50,
                    axisLine: {
                        lineStyle: {
                            color: colors[2]
                        }
                    },
                    axisLabel: {
                        formatter: '{value}'
                    }
                }
            ],
            series: [
                {
                    name:'空气温度',
                    type:'line',
                    yAxisIndex: 0,
                    data: weatherTempList
                },
                {
                    name:'风速',
                    type:'line',
                    yAxisIndex: 1,
                    data: windSpeedList
                },
                {
                    name:'降水量',
                    type:'line',
                    yAxisIndex: 2,
                    data: precipitationList
                }
            ]
        };
        myChart3.setOption(option2);

        $(window).on('resize',
            function() {
                myChart3.resize();
            });
    });

}
//能见度数据统计
function visibilityChart(){
    $.getJSON("baseinfo/lhpdatavisibility/visibilityChart?_"+$.now(), function(r){
        var data=r.data;
        sendVisibility(data);
        var pNameList = data.pNameList;
        var visiList = data.visiList;
        var myChart2 = echarts.init(document.getElementById('visibilityChart'));

        option2 = {
            tooltip: {
                trigger: 'axis'
            },
            xAxis: {
                type: 'category',
                data: pNameList,
                axisLine:{
                    lineStyle:{
                        color:'white',
                        width:1
                    }
                },
                axisLabel: {
                    interval:0,
                    rotate:40
                },
                axisTick: {
                    alignWithLabel: true
                }
            },
            yAxis: {
                name:'单位：m',
                type: 'value',
                axisLine:{
                    lineStyle:{
                        color:'white',
                        width:1
                    }
                }
            },
            legend: {
                data : [ {
                    name :'能见度',
                    textStyle : {
                        color : "#ffffff"
                    }
                }
                ]
            },


            grid:{
                left:40,
                right:20,
                top:40,
                bottom:50
            },
            series:[{
                name:'能见度',
                data:visiList,
                type:'line'
            }

            ]
        };
        myChart2.setOption(option2);
        $(window).on('resize',
            function() {
                myChart2.resize();
            });
    });
}


//初始化地图
var amap;
var lng='117.120098';
var lat='36.6512';
var zoomLevel=8;
//用户角色坐标及缩放等级
function getRoleCoordinates() {
    $.getJSON("baseinfo/lhpwaysectrole/getByUserId?_"+$.now(), function(r){
        if(r.list!=null){
            lng=r.list[0].xgaode;
            lat=r.list[0].ygaode;
            zoomLevel=parseInt(r.list[0].zoomLevel);
        }
        initAMap();
    });
}

var weathMarker;
function initAMap() {
    amap = new AMap.Map('ditu', {
        resizeEnable : true,
        center : [ lng, lat ],
        zoom : zoomLevel,
        zooms : [ 5, 18 ]
    });
    //地图加载完成后运行的方法
    amap.on('complete', function() {
        getUser();
        initAMapPoint();
       showAlertByUser();
       jiaotong();
       //gaodeMap();



        //显示点击位置的天气情况
        amap.on('click', function(e) {
            var lng = e.lnglat.getLng();
            var lat = e.lnglat.getLat();
             var lnglatXY = [ lng, lat ];
             if (weathMarker)
                 weathMarker.setMap(null);
             weathMarker = new AMap.Marker({
                 map : amap,
                 position : lnglatXY
            });
             //逆地址编码
             var geocoder = new AMap.Geocoder({
                 radius : 1000,
                 extensions : "all"
             });
             geocoder.getAddress(lnglatXY, function(status, result) {
                 if (status === 'complete' && result.info === 'OK') {
                     var address = result.regeocode.formattedAddress;
                     queryMarkerWeath(address, lng, lat);
                 }
             });
        });

    });
}

var lineList;
//高德地图（展示全省路网）
function gaodeMap() {
    lineList = [];
    $.ajax({
        type : "post",
        url : "homepage/getRoadLines", //pathWeath
        data : {},
        dataType:"json",
        success : function(data) {
            var polyPath = data;
            for (var i = 0; i < polyPath.length; i++) {
                var line = polyPath[i].polyArr;
                var lineArr=[];
                for (let j = 0; j < line.length; j++) {
                    lineArr.push(line[j].split(","))
                }
                var polyColor = polyPath[i].polyColor;
                var polyId = polyPath[i].polySectId;
                console.log(lineArr)
                var polyline = new AMap.Polyline({
                    path : lineArr, //设置线覆盖物路径
                    strokeColor : polyColor, //线颜色
                    strokeOpacity : 1, //线透明度
                    strokeWeight : 5, //线宽
                    strokeStyle : "solid", //线样式
                    strokeDasharray : [ 10, 5 ], //补充线样式
                    cursor : "pointer"
                });
                var centerIndex = parseInt(lineArr.length / 2);
                if (centerIndex >= lineArr.length) {
                    centerIndex = 0;
                }
                var gpsA = lineArr[centerIndex];
                polyline.setExtData(polyId + "," + gpsA);
                polyline.setMap(amap);
                //polyline.on('click', polylineMouseOver);

                lineList.push(polyline);
                if (i == (polyPath.length - 1)) {
                    dialogLoading(false);
                }
            }
        },
        beforeSend : function() {
            dialogLoading(true);
        },
        complete : function() {}
    });
}

//显示安装点，并配置安装点点击事件
var aPointCluster;
var pointMarkerMap = new Map();
var pointMap=new Map()
function initAMapPoint() {
    if (aPointCluster) {
        aPointCluster.setMap(null);
    }
    var pointMarkers = [];

    $.ajax({
        type : "post",
        url : "baseinfo/lhpinstallationpoint/getPointByUserId",
        data : {},
        dataType : "json",
        async : false,
        success : function(r) {
            var data=r.list;
            for (var i = 0; i < data.length; i++) {
                var pointId = data[i].id;
                var pCode = data[i].pointCode;
                var x = data[i].xgaode;
                var y = data[i].ygaode;
                var pointName = data[i].pointName;
                pointMap.set(pointId, [x,y]);
                if (pointName.indexOf("凝冰") < 0) {
                    var pointEquipStatus = data[i].pointEquipStatus;
                    var imgUrl = "../statics/image/bluePoint.png";
                    var marker = new AMap.Marker({
                        title : pointName,
                        position : [x, y],
                        icon : new AMap.Icon({
                            size : new AMap.Size(29, 29), //图标大小
                            image : imgUrl
                        })
                    });
                    marker.setMap(amap);
                    pointMarkerMap.set(pointId, marker);
                    pointMarkers.push(marker);
                    var hasNingbing = data[i].hasNingbing;

                    markerClick(pointId, hasNingbing, marker, pointName, x, y, pCode);

                }
                if (i == (data.length - 1)) { //点聚合
                    aPointCluster = new AMap.MarkerClusterer(amap, pointMarkers); //gridSize 范围设定
                }
            }
        }
    });
}
//点击安装点，弹框事件
function markerClick(pId, hasNingbing, marker, pointName, xGaode, yGaode, pCode) {
    marker.on('click', function(e) {
        var width = "0px";
        var height = "0px";
        var scStatus = true;
        if (hasNingbing == "0") { //弹到含有凝冰和 气象点信息框
            width = "1200px";
            height = "805px";
            scStatus = false;
            dialogOpen({
                title : '设备参数',
                url : '../../modules/baseinfo/ningBingControllPage.html?pointId='+pId,
                width : width,
                height : height,
                scroll : scStatus,
                btn : '关闭',
                yes : function() {
                    layer.closeAll();
                }
            });
        } else { //弹到气象点信息框
            width = "1300px";
            height = "600px";
            scStatus = false;
            dialogOpen({
                title : '设备参数',
                url : '../../modules/baseinfo/showEquipmentParams.html?pointId='+pId,
                width : width,
                height : height,
                scroll : scStatus,
                btn : '关闭',
                yes : function() {
                    layer.closeAll();
                }
            });
        }

    });
}
//点击最恶劣情况跳点
function showInsPoint(index) {
    var xy;
    if (index == 1) {
        var  pointId=$("#xy1").val();
        xy=pointMap.get(pointId);
    }
    if (index == 2) {
        var  pointId=$("#xy2").val();
        xy=pointMap.get(pointId);
    }
    if (index == 3) {
        var  pointId=$("#xy3").val();
        xy=pointMap.get(pointId);
    }
    if (index == 4) {
        var  pointId=$("#xy4").val();
        xy=pointMap.get(pointId);
    }
    if (index == 5) {
        var  pointId=$("#xy5").val();
        xy=pointMap.get(pointId);
    }
    if (index == 6) {
        var  pointId=$("#xy6").val();
        xy=pointMap.get(pointId);
    }
    if (index == 7) {
        var  pointId=$("#xy7").val();
        xy=pointMap.get(pointId);
    }
    if (index == 8) {
        var  pointId=$("#xy8").val();
        xy=pointMap.get(pointId);
    }
    amap.setZoomAndCenter(12, xy);
}
//显示元素报警信息
function showElementAlarmInfo(obj,index){
    elementCode = index;
    $("#elementAlertInfoParent").css("display","none");
    if($(obj).html() != 0){
        showElementAlert(index);
    }
}

//报警声音开关
var flag1 = 0;
var flag2 = 0;
var flag3 = 0;
function soundControll(obj, index) {
    if (index == 1) {
        if (flag1 == 0) {
            $(obj).attr("src", "../statics/image/close.png");
            flag1 = 1;
        } else {
            $(obj).attr("src", "../statics/image/open.png");
            flag1 = 0;
        }
    }
    if (index == 2) {
        if (flag2 == 0) {
            $(obj).attr("src", "../statics/image/close.png");
            flag2 = 1;
        } else {
            $(obj).attr("src", "../statics/image/open.png");
            flag2 = 0;
        }
    }
    if (index == 3) {
        if (flag3 == 0) {
            $(obj).attr("src", "../statics/image/close.png");
            flag3 = 1;
        } else {
            $(obj).attr("src", "../statics/image/open.png");
            flag3 = 0;
        }
    }
}
//预警声音管理
soundManager.setup({
    url : '../statics/sound/swf/', //swf文件夹的位置
    onready : function() {
        soundManager.createSound({
            id : 'alarm',
            autoLoad : true,
            autoPlay : false,
            url : '../statics/sound/mp3/9.mp3' //mp3文件的位置
        });
    }
});
//播放预警声音
function alertSound() {
    soundManager.play('alarm');
}
//自动滚动
function autoScroll(obj) {
    var n = $(obj).find("li").height();
    $(obj).find("ul").animate({
        marginTop : -5
    }, 500, function() {
        $(this).css({
            marginTop : "0px"
        }).find("li:first").appendTo(this);
    })
}

var t1 = setInterval('autoScroll("#alertInfoParent")', 1500);
var t2 = setInterval('autoScroll("#elementAlertInfoParent")', 1500);
setInterval("showAlertByUser();", 300000);
$(document).ready(function() {
    $("#alertInfo").hover(
        function() {
            clearInterval(t1);
        },
        function() {
            clearInterval(t2);
            t1 = setInterval('autoScroll("#alertInfoParent")', 1500);
            t2 = setInterval('autoScroll("#elementAlertInfoParent")', 1500);
        }
    );
    $("#elementAlertInfo").hover(
        function() {
            clearInterval(t2);
        },
        function() {
            clearInterval(t1);
            t1 = setInterval('autoScroll("#alertInfoParent")', 1500);
            t2 = setInterval('autoScroll("#elementAlertInfoParent")', 1500);
        }
    );

});

//报警定位安装点
function showPoint1(ele) {
    var pointId = ($(ele).attr("class"));
    var xy=pointMap.get(pointId);
    amap.setZoomAndCenter(12, xy);
}

//右侧报警信息显示
function showAlertByUser() {
    $.ajax({
        type : "post",
        url : "homepage/showAlertByUser",
        data : {},
        dataType : "json",
        success : function(r) {
            var data=r.infoMap.fanhui;
            var alert1 = "";
            if(data.length>0){
                $("#alertInfoParent").css("display","block");
                for (var i = 0; i < data.length; i++) {
                    alert1 += "<li class=\"" + data[i].pointId + "\" style=\"color:red;font-size: 16px;width:99%;font-weight: 600;margin: 6px 0\" onclick=\"showPoint1(this);\">" + data[i].alertTime + "&nbsp;&nbsp;" + data[i].pointName + "&nbsp;&nbsp;" + data[i].alertInfo + "</li>";
                    //根据安装点id找到安装点,并根据预警类型更换图片
                    var mar = pointMarkerMap.get(data[i].pointId);
                    //根据预警类型找到图片
                    var imgurl = "";
                    if (data[i].alertLevel == "1" || data[i].alertLevel == "2") {
                        imgurl = "../statics/image/seriousPoint.gif"
                    } else {
                        imgurl = "../statics/image/yellowPoint.gif"
                    }
                    //改变安装点图片
                    mar.setIcon(imgurl);
                }
            }else{
                $("#alertInfoParent").css("display","none");
                alert1 += "<li style=\"color:white;font-size: 16px;width:99%;font-weight: 600;margin: 6px 0\"> 无预警信息</li>";
            }
            $("#alertInfo").html(alert1);
            //设置报警数量
            if(r.infoMap.roadSurfaceTemp == 0){
                $("#roadSurfaceTempCount").html(0)
            }else{
                $("#roadSurfaceTempCount").html(r.infoMap.roadSurfaceTemp);
            }
            if(r.infoMap.friction == 0){
                $("#frictionCount").html(0)
            }else{
                $("#frictionCount").html(r.infoMap.friction);
            }
            if(r.infoMap.waterFilmHeight == 0){
                $("#waterFilmHeightCount").html(0)
            }else{
                $("#waterFilmHeightCount").html(r.infoMap.waterFilmHeight);
            }
            if(r.infoMap.visibility == 0){
                $("#visibilityCount").html(0)
            }else{
                $("#visibilityCount").html(r.infoMap.visibility);
            }
            if(r.infoMap.airTemp == 0){
                $("#airTempCount").html(0)
            }else{
                $("#airTempCount").html(r.infoMap.airTemp);
            }
            if(r.infoMap.relativeHumidity == 0){
                $("#relativeHumidityCount").html(0)
            }else{
                $("#relativeHumidityCount").html(r.infoMap.relativeHumidity);
            }
            if(r.infoMap.windSpeed == 0){
                $("#windSpeedCount").html(0)
            }else{
                $("#windSpeedCount").html(r.infoMap.windSpeed);
            }
            if(r.infoMap.precipitation == 0){
                $("#precipitationCount").html(0)
            }else{
                $("#precipitationCount").html(r.infoMap.precipitation);
            }

            //播放警报
           /* if ((njd.length != 0 && flag1 == 0) || (lmwd.length != 0 && flag2 == 0) || (shcd.length != 0 && flag3 == 0)) {
                alertSound();
            }*/
        }
    });
}

//查看更多报警信息
function findMore() {
    $("#alertInfoParent").css("display","none");
    $("#elementAlertInfoParent").css("display","none");
    dialogOpen({
        title : '报警信息详情',
        url : '../../modules/baseinfo/lhpalert.html?alertType=' + elementCode,
        width : '1630px',
        height : '750px',
        scroll : "yes",
        //btn:'关闭',
        yes : function() {
            layer.closeAll();
            //layer.close(index);
        }
    });
}
function findMore1() {
    $("#alertInfoParent").css("display","none");
    $("#elementAlertInfoParent").css("display","none");
    dialogOpen({
        title : '报警信息详情',
        url : '../../modules/baseinfo/lhpalert.html?alertType=',
        width : '1630px',
        height : '750px',
        scroll : "yes",
        //btn:'关闭',
        yes : function() {
            layer.closeAll();
            //layer.close(index);
        }
    });
}
//左边五个点的点击方法
var visoverlayGroup = new AMap.OverlayGroup();//能见度图层
var shcdoverlayGroup = new AMap.OverlayGroup();//湿滑程度
var lmwdoverlayGroup = new AMap.OverlayGroup();//路面温度
var smhdoverlayGroup = new AMap.OverlayGroup();//水膜厚度
var fsoverlayGroup = new AMap.OverlayGroup();//风速
var kqwdoverlayGroup = new AMap.OverlayGroup();//空气温度
var xdsdoverlayGroup = new AMap.OverlayGroup();//相对湿度
var jsloverlayGroup = new AMap.OverlayGroup();//降水量
function showParamOverlay(type) {
    dialogLoading(true);
    if (pointMarkerMap) {
        pointMarkerMap.forEach(function(value, key, map) {
            amap.remove(value);
        });
    }
    removeTxtFromMap();
    if (type == 0) { //安装点
        initAMapPoint();
        showAlertByUser();
        document.getElementById("qiehuanditu").style.display = "none";
        document.getElementById("tuli").style.display = "none";
    } else {
        if (aPointCluster) {
            aPointCluster.setMap(null);
        }
    }
    if (type == 1) { //能见度 （查询能见度分析仪）
        // 最近的一条记录
        $.ajax({
            type : "post",
            url : "baseinfo/lhpdatavisibility/visibilityOverlay",
            data : {},
            dataType : "json",
            success : function(r) {
                var data=r.data;
                for (var i = 0; i < data.length; i++) {
                    var vis = data[i];
                    var pointId = vis.pointId;
                    var visValue = vis.visibility;
                    var value1 = '良好';
                    var color1 = '#11EE69';
                    if (visValue <= 50) {
                        value1 = '大雾';
                        color1 = '#ff6766';
                    } else if (visValue <= 200) {
                        value1 = '浓雾';
                        color1 = '#ff6766';
                    } else if (visValue <= 500) {
                        value1 = '雾';
                        color1 = '#ff6766';
                    } else if (visValue <= 1000) {
                        value1 = '中雾';
                        color1 = '#ff9933';
                    } else if (visValue < 2000) {
                        value1 = '轻雾';
                        color1 = '#ff9933';
                    }
                    var pMarker = pointMarkerMap.get(pointId);
                    var lnglat = pMarker.getPosition();
                    var text = new AMap.Text({
                        text : visValue + " 米(" + value1 + ")",
                        textAlign : 'center', // 'left' 'right', 'center',
                        verticalAlign : 'middle', //middle 、bottom
                        draggable : true,
                        cursor : 'pointer',
                        angle : 0,
                        style : {
                            'background-color' : color1,
                            'border' : 'solid 1px #0088ff',
                            'padding' : '3px 3px'
                        },
                        position : lnglat
                    });
                    visoverlayGroup.addOverlay(text);
                    if (i == (data.length - 1)) {
                        amap.add(visoverlayGroup);
                    }
                }

            },
            complete : function() {
                dialogLoading(false);
            }
        });
    }
    if (type == 2 || type == 3 || type == 6) { //路面探测器
        // 最近的一条记录
        $.ajax({
            type : "post",
            url : "baseinfo/lhpdataroaddetector/roadDetectorOverlay",
            data : {},
            dataType : "json",
            success : function(r) {
                var data=r.data;
                for (var i = 0; i < data.length; i++) {
                    var vis = data[i];
                    var pointId = vis.pointId;
                    if (type == 2) { //湿滑程度
                        var shcd = vis.friction;
                        var value1 = '良好';
                        var color1 = '#11EE69';
                        if (shcd <= 0.3) {
                            value1 = '极差';
                            color1 = '#ff6766';
                        } else if (shcd <= 0.4) {
                            value1 = '很差';
                            color1 = '#ff6766';
                        } else if (shcd <= 0.5) {
                            value1 = '较差';
                            color1 = '#ff9933';
                        } else if (shcd <= 0.55) {
                            value1 = '稍差';
                            color1 = '#ff9933';
                        } else if (shcd <= 0.64) {
                            value1 = '正常';
                        }
                        var pMarker = pointMarkerMap.get(pointId);
                        var lnglat = pMarker.getPosition();
                        var text = new AMap.Text({
                            text : shcd + " (" + value1 + ")",
                            textAlign : 'center', // 'left' 'right', 'center',
                            verticalAlign : 'middle', //middle 、bottom
                            draggable : true,
                            cursor : 'pointer',
                            angle : 1,
                            style : {
                                'background-color' : color1,
                                'border' : 'solid 1px #0088ff',
                                'padding' : '3px 3px'
                            },
                            position : lnglat
                        });
                        shcdoverlayGroup.addOverlay(text);
                        if (i == (data.length - 1)) {
                            amap.add(shcdoverlayGroup);
                        }
                    }
                    if (type == 3) { //路面温度
                        var lmwd = vis.roadSurfaceTemp;
                        var color1 = '#11EE69';
                        if (lmwd < 0) {
                            color1 = '#ff9933';
                        } else if (lmwd >= 55) {
                            color1 = '#ff9933';
                        }
                        var pMarker = pointMarkerMap.get(pointId);
                        var lnglat = pMarker.getPosition();
                        var text = new AMap.Text({
                            text : lmwd + " ℃",
                            textAlign : 'center', // 'left' 'right', 'center',
                            verticalAlign : 'middle', //middle 、bottom
                            draggable : true,
                            cursor : 'pointer',
                            angle : 1,
                            style : {
                                'background-color' : color1,
                                'border' : 'solid 1px #0088ff',
                                'padding' : '3px 3px'
                            },
                            position : lnglat
                        });
                        lmwdoverlayGroup.addOverlay(text);
                        if (i == (data.length - 1)) {
                            amap.add(lmwdoverlayGroup);
                        }
                    }
                    if (type == 6) { //水膜厚度
                        var smhd = vis.waterFilmHeight;
                        var color1 = '#11EE69';
                        if (smhd >= 100) {
                            color1 = '#ff9933';
                        }
                        var pMarker = pointMarkerMap.get(pointId);
                        var lnglat = pMarker.getPosition();
                        var text = new AMap.Text({
                            text : smhd + " μm",
                            textAlign : 'center', // 'left' 'right', 'center',
                            verticalAlign : 'middle', //middle 、bottom
                            draggable : true,
                            cursor : 'pointer',
                            angle : 1,
                            style : {
                                'background-color' : color1,
                                'border' : 'solid 1px #0088ff',
                                'padding' : '3px 3px'
                            },
                            position : lnglat
                        });
                        smhdoverlayGroup.addOverlay(text);
                        if (i == (data.length - 1)) {
                            amap.add(smhdoverlayGroup);
                        }
                    }
                }
            },
            complete : function() {
                dialogLoading(false);
            }
        });
    }
    if (type == 4 || type == 5 || type == 7||type == 8) { //气象站
        $.ajax({
            type : "post",
            url : "baseinfo/lhpdataweatherstation/weatherStationOverlay",
            data : {},
            dataType : "json",
            success : function(r) {
                var data=r.data;
                for (var i = 0; i < data.length; i++) {
                    var ws = data[i];
                    var pointId = ws.pointId;
                    var pMarker = pointMarkerMap.get(pointId);
                    var lnglat = pMarker.getPosition();
                    if (type == 4) {
                        var windSpeed = ws.windSpeed;
                        var value1 = '无风';
                        var color1 = '#11EE69';
                        if (windSpeed <= 0.3) {
                        } else if (windSpeed <= 1.5) {
                            value1 = '一级';
                        } else if (windSpeed <= 3.3) {
                            value1 = '二级';
                        } else if (windSpeed <= 5.4) {
                            value1 = '三级';
                        } else if (windSpeed <= 7.9) {
                            value1 = '四级';
                            color1 = '#ff9933';
                        } else if (windSpeed <= 10.7) {
                            value1 = '五级';
                            color1 = '#ff9933';
                        } else if (windSpeed <= 13.8) {
                            value1 = '六级';
                            color1 = '#ff9933';
                        } else if (windSpeed <= 17.1) {
                            value1 = '七级';
                            color1 = '#ff9933';
                        } else if (windSpeed <= 20.7) {
                            value1 = '八级';
                            color1 = '#ff6766';
                        } else if (windSpeed <= 24.4) {
                            value1 = '九级';
                            color1 = '#ff6766';
                        } else if (windSpeed <= 28.4) {
                            value1 = '十级';
                            color1 = '#ff6766';
                        } else if (windSpeed <= 32.6) {
                            value1 = '十一级';
                            color1 = '#ff6766';
                        } else {
                            value1 = '台风';
                            color1 = '#ff6766';
                        }
                        var text = new AMap.Text({
                            text : windSpeed + " m/s(" + value1 + ")",
                            textAlign : 'center', // 'left' 'right', 'center',
                            verticalAlign : 'middle', //middle 、bottom
                            draggable : true,
                            cursor : 'pointer',
                            angle : 0,
                            style : {
                                'background-color' : color1,
                                'border' : 'solid 1px #0088ff',
                                'padding' : '3px 3px'
                            },
                            position : lnglat
                        });
                        fsoverlayGroup.addOverlay(text);
                        if (i == (data.length - 1)) {
                            amap.add(fsoverlayGroup);
                        }
                    }
                    if (type == 5) {
                        var ambientTemp = ws.ambientTemp;
                        var text = new AMap.Text({
                            text : ambientTemp + " ℃",
                            textAlign : 'center', // 'left' 'right', 'center',
                            verticalAlign : 'middle', //middle 、bottom
                            draggable : true,
                            cursor : 'pointer',
                            angle : 0,
                            style : {
                                'background-color' : '#11EE69',
                                'border' : 'solid 1px #0088ff',
                                'padding' : '3px 3px'
                            },
                            position : lnglat
                        });
                        kqwdoverlayGroup.addOverlay(text);
                        if (i == (data.length - 1)) {
                            amap.add(kqwdoverlayGroup);
                        }
                    }
                    if (type == 7) {
                        var relativeHumidity = ws.relativeHumidity;
                        var text = new AMap.Text({
                            text : relativeHumidity + " %",
                            textAlign : 'center', // 'left' 'right', 'center',
                            verticalAlign : 'middle', //middle 、bottom
                            draggable : true,
                            cursor : 'pointer',
                            angle : 0,
                            style : {
                                'background-color' : '#11EE69',
                                'border' : 'solid 1px #0088ff',
                                'padding' : '3px 3px'
                            },
                            position : lnglat
                        });
                        xdsdoverlayGroup.addOverlay(text);
                        if (i == (data.length - 1)) {
                            amap.add(xdsdoverlayGroup);
                        }
                    }
                    if (type == 8) {
                        var precipitation = ws.precipitation;
                        var text = new AMap.Text({
                            text : precipitation + " mm",
                            textAlign : 'center', // 'left' 'right', 'center',
                            verticalAlign : 'middle', //middle 、bottom
                            draggable : true,
                            cursor : 'pointer',
                            angle : 0,
                            style : {
                                'background-color' : '#11EE69',
                                'border' : 'solid 1px #0088ff',
                                'padding' : '3px 3px'
                            },
                            position : lnglat
                        });
                        jsloverlayGroup.addOverlay(text);
                        if (i == (data.length - 1)) {
                            amap.add(jsloverlayGroup);
                        }
                    }
                }
            },
            complete : function() {
                dialogLoading(false);
            }
        });
    }
}

//移除其他图层
function removeTxtFromMap() {
    if (visoverlayGroup) {
        visoverlayGroup.setMap(null);
        visoverlayGroup.clearOverlays();
    }
    if (shcdoverlayGroup) {
        shcdoverlayGroup.setMap(null);
        shcdoverlayGroup.clearOverlays();
    }
    if (lmwdoverlayGroup) {
        lmwdoverlayGroup.setMap(null);
        lmwdoverlayGroup.clearOverlays();
    }
    if (smhdoverlayGroup) {
        smhdoverlayGroup.setMap(null);
        smhdoverlayGroup.clearOverlays();
    }
    if (fsoverlayGroup) {
        fsoverlayGroup.setMap(null);
        fsoverlayGroup.clearOverlays();
    }
    if (kqwdoverlayGroup) {
        kqwdoverlayGroup.setMap(null);
        kqwdoverlayGroup.clearOverlays();
    }
    if (xdsdoverlayGroup) {
        xdsdoverlayGroup.setMap(null);
        xdsdoverlayGroup.clearOverlays();
    }
    if (jsloverlayGroup) {
        jsloverlayGroup.setMap(null);
        jsloverlayGroup.clearOverlays();
    }
}

//图例开关
function showTuli() {
    var value = document.getElementById("tuli").style.display;
    if (value == 'none') {
        document.getElementById("tuli").style.display = "block";
        document.getElementById("qiehuanditu").style.display = "none";
    } else {
        document.getElementById("tuli").style.display = "none";
    }
}
//主题开关
function showZhuti() {
    var value = document.getElementById("qiehuanditu").style.display;
    if (value == 'none') {
        document.getElementById("qiehuanditu").style.display = "block";
        document.getElementById("tuli").style.display = "none";
    } else {
        document.getElementById("qiehuanditu").style.display = "none";
    }
}

    //保存用户主题
function refreshBaseMap(obj, enName) {
    amap.setMapStyle('amap://styles/' + enName);
    user.mapTheme=enName;
    //样式保存到数据库
    $.ajax({
        type: "POST",
        url: baseURL + "sys/user/update",
        contentType: "application/json",
        data: JSON.stringify(user),
        success: function(r){

        }
    });
    var a = $(".xuanze p").eq(0).attr("value");
    $(".xuanze p").eq(0).css("color", "white");
    $(".xuanze").css("background-image", "url(../statics/image/" + a + "2.png)");
    $(".xuanze").removeClass("xuanze");
    $(obj).addClass("xuanze");
    a = $(".xuanze p").eq(0).attr("value");
    $(".xuanze").css("background-image", "url(../statics/image/" + a + "1.png)");
    $(".xuanze p").eq(0).css("color", "#0ff");
}
//实时交通图层
var traffic;
var btnTraffic;
function jiaotong() {
    traffic = new AMap.TileLayer.Traffic({
        'autoRefresh' : true, //是否自动刷新，默认为false
        'interval' : 180, //刷新间隔，默认180s
    });
    amap.add(traffic); //通过add方法添加图层
    btnTraffic = 1;
}

//关闭实时交通
function closejiaotong() {
    amap.remove(traffic);
    btnTraffic = 0;
}
function jiaotong1() {
    if (btnTraffic == "1") {
        closejiaotong();
    } else {
        jiaotong();
    }
}

//绘制省界
function addSDBounds() {
    //加载行政区划插件
    AMap.service('AMap.DistrictSearch', function() {
        var opts = {
            subdistrict: 1,   //返回下一级行政区
            extensions: 'all',  //返回行政区边界坐标组等具体信息
            level: 'city'  //查询行政级别为 市
        };
        //实例化DistrictSearch
        district = new AMap.DistrictSearch(opts);
        district.setLevel('district');
        //行政区查询
        district.search('山东', function(status, result) {
            var bounds = result.districtList[0].boundaries;
            var polygons = [];
            if (bounds) {
                for (var i = 0, l = bounds.length; i < l; i++) {
                    //生成行政区划polygon
                    var polygon = new AMap.Polygon({
                        map: amap,
                        strokeWeight: 2,
                        path: bounds[i],
                        fillOpacity: 0.2,
                        fillColor: '#CCF3FF',
                        strokeColor: 'red'
                    });

                    polygon.on('click',function(e){

                        var lng=e.lnglat.getLng();
                        var lat=e.lnglat.getLat();
                        var lnglatXY=[lng, lat];
                        if(weathMarker)
                            weathMarker.setMap(null);
                        weathMarker= new AMap.Marker({
                            map:amap,
                            position: lnglatXY
                        });
                        //逆地址编码
                        var geocoder = new AMap.Geocoder({
                            radius: 1000,
                            extensions: "all"
                        });
                        geocoder.getAddress(lnglatXY, function(status, result) {
                            if (status === 'complete' && result.info === 'OK') {
                                var address = result.regeocode.formattedAddress; //返回地址描述
                                queryMarkerWeath(address,lng,lat);
                            }
                        });
                    });
                    polygons.push(polygon);
                }
                // map.setFitView();//地图自适应
            }
        });


    });
}
//自建站信息
function equipmentInfo() {
    document.getElementById("qiehuanditu").style.display = "none";
    document.getElementById("tuli").style.display = "none";
    dialogOpen({
        title : '自建站参数列表',
        url : '../../modules/baseinfo/lhpDataEquipmentinfo.html',
        width : '1630px',
        height : '750px',
        scroll : "yes",
        //btn:'关闭',
        yes : function() {
            layer.closeAll();
            //layer.close(index);
        }
    });
}

//根据经纬度查询 天气预报
function queryMarkerWeath(address, lng, lat) {
    $.ajax({
        type : "POST",
        url : "../../homepage/getMarkerWeather",
        data : {
            xgps : lng,
            ygps : lat
        },
        dataType : "json",
        success : function(r) {
            var data=r.list;
            realWeather = data[0].skyCon;
            var realInfo;
            if (realWeather == 'RAIN') {
                var rainType = data[0].skyConName;
                var fsValue = data[0].speed;
                var fsDj = data[0].fsDj;
                var fD = data[0].direction;
                realInfo = rainType + "&nbsp;, 气温 : " + data[0].temperature + "℃, 相对湿度 : " + data[0].humidity + "% <br/> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; &nbsp;云量 : " + data[0].cloudrate + " , 气压 : " + data[0].pres + "pa  <br/> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; &nbsp;风速 : " + data[0].speed + "km/h (" + data[0].fsDj + ")" + ", 风向 : " + data[0].fx + "";
            } else if (data[0].distance == "") {
                var rainType = data[0].skyConName;
                var dis = data[0].distance;
                if (dis == "无降雨") {
                    realInfo = rainType + "&nbsp;, 气温 : " + data[0].temperature + "℃, 相对湿度 : " + data[0].humidity + "% <br/> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; &nbsp;风速 : " + data[0].speed + "km/h (" + data[0].fsDj + ")" + ", 风向 : " + data[0].fx;
                } else {
                    realInfo = rainType + "&nbsp;, 气温 : " + data[0].temperature + "℃, 相对湿度 : " + data[0].humidity + "% <br/> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; &nbsp;风速 : " + data[0].speed + "km/h (" + data[0].fsDj + ")" + ", 风向 : " + data[0].fx;
                }
            } else {
                var rainType = data[0].skyConName;
                var dis = data[0].distance;
                if (dis == "无降雨") {
                    realInfo = rainType + "&nbsp;, 气温 : " + data[0].temperature + "℃, 相对湿度 : " + data[0].humidity + "% <br/> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; &nbsp;风速 : " + data[0].speed + "km/h (" + data[0].fsDj + ")" + ", 风向 : " + data[0].fx
                        + "<br/> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; &nbsp;最近降雨带距离:" + data[0].distance;
                } else {
                    realInfo = rainType + "&nbsp;, 气温 : " + data[0].temperature + "℃, 相对湿度 : " + data[0].humidity + "% <br/> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; &nbsp;风速 : " + data[0].speed + "km/h (" + data[0].fsDj + ")" + ", 风向 : " + data[0].fx
                        + " <br/> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp; &nbsp;最近降雨带距离:" + data[0].distance + " , " + data[0].nestRanType;
                }
            }
            weather = JSON.parse(data[1]);
            weather = weather.resultData;
            var weatherArr = weather.split("<br>");
            var title = '<div class="tqyb_tit"><span>天气预报</span></div>';
            var content = [];
            content.push("<img src='../statics/image/dizhi.png'></img>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;点 : " + address);
            content.push("<img src='../statics/image/sstq.png'></img>实时天气 : " + realInfo + "");
            content.push("<img src='../statics/image/tqyb.png'></img>天气预报 : " + weatherArr[0] + "");
            content.push("<img src='../statics/image/ybms.png'></img>预报描述 : " + weatherArr[1] + "");
            infoWindow = new AMap.InfoWindow({
                isCustom : true,
                content : createInfoWindow(title, content.join("<br/>")),
                offset : new AMap.Pixel(0, -30)
            });
            infoWindow.open(amap, weathMarker.getPosition());
        }
    });
}
//构建自定义信息窗体
function createInfoWindow(title, content) {
    var info = document.createElement("div");
    info.className = "info";
    info.style.width = "350px";
    var top = document.createElement("div");
    var titleD = document.createElement("div");
    var closeX = document.createElement("img");
    top.className = "info-top";
    titleD.innerHTML = title;
    closeX.src = "http://webapi.amap.com/images/close2.gif";
    closeX.onclick = closeInfoWindow;
    top.appendChild(titleD);
    top.appendChild(closeX);
    info.appendChild(top);
    var middle = document.createElement("div");
    middle.className = "info-middle";
    middle.style.backgroundColor = 'white';
    middle.innerHTML = content;
    info.appendChild(middle);
    var bottom = document.createElement("div");
    bottom.className = "info-bottom";
    bottom.style.position = 'relative';
    bottom.style.top = '0px';
    bottom.style.margin = '0 0 0 180px';
    var sharp = document.createElement("img");
    sharp.src = "http://webapi.amap.com/images/sharp.png";
    bottom.appendChild(sharp);
    info.appendChild(bottom);
    return info;
}

//关闭信息窗体
function closeInfoWindow() {
    amap.clearInfoWindow();
    if (weathMarker)
        weathMarker.setMap(null);
}

function closeAlarm() {
    $("#alertInfoParent").css("display","none");
}
function closeElementAlarm() {
    $("#elementAlertInfoParent").css("display","none");
}
function showAlarmDiv(){
    if($("#alertInfoParent").css("display") == "none"){
        $("#alertInfoParent").css("display","block");
    }else{
        $("#alertInfoParent").css("display","none");
    }
}
function showElementAlert(index){
    $.ajax({
        type : "post",
        url : "homepage/showAlertByUserAndElement",
        data : {type:index},
        dataType : "json",
        success : function(r) {
            var data=r.list;
            var alert1 = "";
            if(data.length>0){
                $("#elementAlertInfoParent").css("display","block");
                for (var i = 0; i < data.length; i++) {
                    alert1 += "<li class=\"" + data[i].pointId + "\" style=\"color:red;font-size: 16px;width:99%;font-weight: 600;margin: 6px 0\" onclick=\"showPoint1(this);\">" + data[i].alertTime + "&nbsp;&nbsp;" + data[i].pointName + "&nbsp;&nbsp;" + data[i].alertInfo + "</li>";
                }
            }
            $("#elementAlertInfo").html(alert1);
        }
    });
}
function equipmentStatus(){
    $.ajax({
        type : "post",
        url : "homepage/checkEquipmengStatus",
        data : {},
        dataType : "json",
        success : function(r) {
            var data=r.infoMap;
            $("#qxzOnline").html(data.qxzOnline);
            $("#qxzOffline").html(data.qxzOffline);
            $("#njdOnline").html(data.njdOnline);
            $("#njdOffline").html(data.njdOffline);
            $("#dmtcqOnline").html(data.dmtcqOnline);
            $("#dmtcqOffline").html(data.dmtcqOffline);
        }
    });
}
function findMoreVisibility(){
    dialogOpen({
        title : '能见度信息详情',
        url : '../../modules/baseinfo/lhpdatavisibility.html',
        width : '1630px',
        height : '750px',
        scroll : "yes",
        //btn:'关闭',
        yes : function() {
            layer.closeAll();
            //layer.close(index);
        }
    });
}
function findMoreRoadDetector(){
    dialogOpen({
        title : '地面探测器信息详情',
        url : '../../modules/baseinfo/lhpdataroaddetector.html',
        width : '1630px',
        height : '750px',
        scroll : "yes",
        //btn:'关闭',
        yes : function() {
            layer.closeAll();
            //layer.close(index);
        }
    });
}
function findMoreWeatherStation(){
    dialogOpen({
        title : '气象站信息详情',
        url : '../../modules/baseinfo/lhpdataweatherstation.html',
        width : '1630px',
        height : '750px',
        scroll : "yes",
        //btn:'关闭',
        yes : function() {
            layer.closeAll();
            //layer.close(index);
        }
    });
}
